package h0721;

import java.util.Arrays;
import java.util.Scanner;

/**
  * @description 攀登者1 计算有多少座山峰
  * @author 不知名帅哥
  * @date 2024/7/21 22:08
  * @version 1.0
*/
public class ComputeMountains {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int[] mountains = Arrays.stream(sc.nextLine().split(",")).mapToInt(Integer::parseInt).toArray();

        int count = getCount(mountains);
        System.out.println(count);
    }

    private static int getCount(int[] mountains) {
        int count=0;
        if (mountains.length==1){
            return mountains[0];
        }
        if (mountains.length<3){
            if (mountains[0]> mountains[1]||mountains[1]>mountains[0]){
                count++;
            }
            return count;
        }
        for (int i = 1; i < mountains.length-1; i++) {
            int prev= mountains[i-1];
            int next= mountains[i+1];
            if (mountains[i]>prev&& mountains[i]>next){
                count++;
            }
        }
        return count;
    }
}
